package com.ziiwee.reduce.commons.utils;

import com.ziiwee.reduce.commons.annotations.Export;

import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;

/**
 * @author ziiwee
 * @date 2020/8/13
 */
public class ExportUtil {

    public static boolean isExport(AnnotatedElement element) {
        for (Export export : element.getAnnotationsByType(Export.class)) {
            return export.value();
        }
        return false;
    }

    public static boolean isMethodExport(Class<?> beanType, Method method) {
        if (method.getAnnotationsByType(Export.class).length > 0) {
            return isExport(method);
        }
        return isExport(beanType);
    }

}
